from util import sign
from perceptron import perceptron

""" The voted perseptron algoritnm - the votedron
    The only difference between the regular perceptron and the 
    votedron, the way they calculate the classification.
    Here we use the counters 

to use the kernel trick, one most only give the votedron a kernel function \
instead of the usual dot function.
"""

class votedron(perceptron):

    def classify(self, instance):
        sum = 0
        acc = 0
        #for ins, c in zip(self.Xs, self.count):
        for i in range(len(self.Xs)):
            sum += self.dot(instance, self.Xs[i])
            acc += self.count[i]*sign(sum-self.dot(1,self.w0[i]))
        return sign(acc)
    
